const TOKEN_KEY = 'TOKEN'
const USER_KEY = 'USERINFO'
const TOKENEXPIRESTIME_KEY = 'TOKENEXPIRESTIME'
// 获取 token 
export function getToken() {
	return localStorage.getItem(TOKEN_KEY)
}
// 保存 token 
export function setToken(token) {
	return localStorage.setItem(TOKEN_KEY, token)
}
// 获取用户信息 
export function getUser() {
	return JSON.parse(localStorage.getItem(USER_KEY))
}
//保存用户信息 
export function setUser(user) {
	localStorage.setItem(USER_KEY, JSON.stringify(user))
}
//移除用户信息 
export function removeToken() {
	localStorage.removeItem(TOKEN_KEY)
	localStorage.removeItem(USER_KEY)
	localStorage.removeItem(TOKENEXPIRESTIME_KEY)
}
// 获取 Token过期时间
export function getTokenExpiresTime() {
	return localStorage.getItem(TOKENEXPIRESTIME_KEY)
}
// 保存 Token过期时间
export function setTokenExpiresTime(tokenExpiresTime) {
	return localStorage.setItem(TOKENEXPIRESTIME_KEY, tokenExpiresTime)
}